# ! /usr/bin/python
# coding=utf-8
import requests
import time

headers = {
        'Connection': 'Keep-Alive',
        'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.7',
        # 'accept-encoding': 'gzip, deflate, br, zstd',
        'Accept-Language': 'zh-CN,zh;q=0.9,zh-TW;q=0.8,en;q=0.7',
        'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/85.0.4183.102 Safari/537.36',
        # 'cookie': 'bbs_sid=uglvr5hago7ce2ec0qlmjko8ah; bbs_token=ouwgm2ZQjDISkvWRcBkat1YE9_2BpMp4cQnT2eqnuFOxnyG_2FDzorPScmB1vxZ9sY75IbcFlCuCGhAL61hlIHHEIoWegEw_3D; Hm_lvt_041715a44f3d6718f1e69867b53b8aa0=1760105869,1760156972,1760192379,1760229246; HMACCOUNT=0EF7018863B2E101; cf_clearance=72qQRqDvNXD5VvyxxAPFb6TNSwUlKYF1hTJv8x.kPNE-1760230184-1.2.1.1-c31fYWUqnte2G49Yc5bUVUPKIc7TvovUHTYzKOjycZicQaXXlNsNm.Xg6_1dwDVc3W87aFn5RIm3rfTw6idP9X5Y0tjQa5hcsaBJKK8ixuAamGdF7GvmPJVvjeKbpy0kHE4oyV89N9FvXkYdvh6PbAK6kDzTta1vpHoghq865bk_joIwnO58ImdpWaQWetlf50O0PQjG26E.w52XpTobSeiJ1KbHTfoQkfT2VwQHF0s; Hm_lpvt_041715a44f3d6718f1e69867b53b8aa0=1760230352'
    }

# 请求地址
targetUrl = "https://fitgirl-repacks.site/"
#

get_proxy_url = "http://api.shenlongip.com/ip?key=cxw1xgyk&protocol=2&mr=1&pattern=txt&count=1&sign=59316cd4f2e043676fb744ba801645be"
resp = requests.get(get_proxy_url, timeout=10, headers=headers)
content = resp.content

# #代理服务器
proxyHost = resp.text.split(":")[0].strip()
proxyPort = int(resp.text.split(":")[1].strip())

# 非账号密码验证
proxyMeta = "http://%(host)s:%(port)s" % {

    "host": proxyHost,
    "port": proxyPort,
}
print(f"proxy meta: {proxyMeta}")
# 账号密码验证
# proxyMeta = "http://账号:密码@%(host)s:%(port)s" % {
#    "host": proxyHost,
#    "port": proxyPort,
# }

#
# #pip install -U requests[socks]  socks5代理
# 非账号密码验证
# proxyMeta = "socks5://%(host)s:%(port)s" % {
#
#     "host" : proxyHost,
#
#     "port" : proxyPort,
#
# }
# 账号密码验证
# proxyMeta = "socks5://账号:密码%(host)s:%(port)s" % {
#
#     "host" : proxyHost,
#
#     "port" : proxyPort,
#
# }
#
proxies = {
    "http": proxyMeta,
    "https": proxyMeta
}
#
start = int(round(time.time() * 1000))
resp = requests.get(targetUrl, proxies=proxies, timeout=10)
costTime = int(round(time.time() * 1000)) - start
print(resp.text)
print("耗时：" + str(costTime) + "ms")
